package test0ne.多线程;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 线程池学习
 */
public class ThreadPoolTest {

    public static void main(String[] args) {
        ThreadPoolExecutor executor =  new ThreadPoolExecutor(10, 20, 1, TimeUnit.SECONDS, new ArrayBlockingQueue<>(20));
        //提交没有返回值的任务 用execute()
        executor.execute(new Runnable() {
            @Override
            public void run() {

            }
        });

        //提交又返回值的任务用  submit()
        executor.submit(new Runnable() {
            @Override
            public void run() {

            }
        });
    }

}
